#ifndef IDC_UBUS_LORA_H
#define IDC_UBUS_LORA_H
#include "idc_ubus_common.h"

static const struct blobmsg_policy lora_set_addr_policy[] = {
    [0] = { .name = "addr", .type = BLOBMSG_TYPE_STRING },
    [1] = { .name = "group_addr", .type = BLOBMSG_TYPE_STRING },
}; 
static const struct blobmsg_policy lora_set_cell_policy[] = {
    [0] = { .name = "id", .type = BLOBMSG_TYPE_INT32 },
}; 
static const struct blobmsg_policy lora_set_pwr_policy[] = {
    [0] = { .name = "pwr", .type = BLOBMSG_TYPE_INT32 },
}; 
static const struct blobmsg_policy lora_set_wor_policy[] = {
    [0] = { .name = "wor", .type = BLOBMSG_TYPE_INT32 },
}; 
static const struct blobmsg_policy lora_set_bps_policy[] = {
    [0] = { .name = "type", .type = BLOBMSG_TYPE_INT32 }, //0:ctrl; 1:data
    [1] = { .name = "bps", .type = BLOBMSG_TYPE_INT32 },
};
static const struct blobmsg_policy lora_set_lp_policy[] = {
    [0] = { .name = "lp", .type = BLOBMSG_TYPE_INT32 },
}; 
static const struct blobmsg_policy lora_set_awake_policy[] = {
    [0] = { .name = "awake", .type = BLOBMSG_TYPE_INT32 },
}; 
static const struct blobmsg_policy lora_set_trans_policy[] = {
    [0] = { .name = "mode", .type = BLOBMSG_TYPE_INT32 },
    [1] = { .name = "addr", .type = BLOBMSG_TYPE_STRING },
    [2] = { .name = "type", .type = BLOBMSG_TYPE_INT32 },
};
static const struct blobmsg_policy lora_at_send_policy[] = {
    [0] = { .name = "addr", .type = BLOBMSG_TYPE_STRING },
    [1] = { .name = "data", .type = BLOBMSG_TYPE_STRING },
}; 
static const struct blobmsg_policy lora_trans_send_policy[] = {
    [0] = { .name = "data", .type = BLOBMSG_TYPE_STRING }
}; 
/**
 * num表示通道号为0，表示控制所有通道，大于0表示控制指定通道
 * val值为0表示关闭，1表示打开；如果
*/
int query_lora_ver(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_reboot(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_esn(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int lora_in_at(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int lora_exit_at(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int lora_reset(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_addr(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_addr(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_cell(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_cell(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_pwr(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_pwr(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_wor(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_wor(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_bps(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_bps(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_lp(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_lp(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_awake(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_awake(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int query_lora_trans(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int set_lora_trans(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int at_send_data(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
int trans_send_data(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
#endif